pg_dump 數據庫轉儲是“當時”轉儲嗎? (Is a pg_dump DB dump 'at-that-time' dump?)


問題描述

pg_dump 數據庫轉儲是“當時”轉儲嗎? (Is a pg_dump DB dump 'at-that-time' dump?)

I know PostgresQL pg_dump guarantees consistency even if DB is modified while dump is going on, but I want to know if the final dump contains any data modified/inserted after the dump started.

To elaborate:

  1. Time t:     I start pg_dump
  2. Time t+1:  There are updates/inserts to the database
  3. Time t+x:  pg_dump completes.

I don't want any of the modifications done in the 'x' period to be present in the dump file.

Is this possible?


參考解法

方法 1:

This was answered in another SO question: Doing pg_dump while still many active transaction.

The short answer is yes: pg_dump opens a transaction and no changes made to the database will be visible to it during the dump, so pg_dump snapshots are atomic and are a consistent snapshot (iow, no foreign key or other constraints will be violated in the snapshot).

HTH

(by FinslicerKyle Burton)

參考文件

  1. Is a pg_dump DB dump 'at-that-time' dump? (CC BY-SA 3.0/4.0)

#pg-dump #postgresql






相關問題

如何檢查我是否只刪除了所需的數據? (How do I check that I removed required data only?)

無法恢復 pg_dump 備份 (Unable to restore pg_dump backup)

使用帶有 Curl 的緩衝輸出將文件上傳到 ftp 服務器 (Upload a file into a ftp server using buffered output with Curl)

帶有 -C 選項的 pg_restore 不會創建數據庫 (pg_restore with -C option does not create the database)

pg_dump 數據庫轉儲是“當時”轉儲嗎? (Is a pg_dump DB dump 'at-that-time' dump?)

PSQL 數據庫傳輸和錯誤 (PSQL database transfer and errors)

Postgres pg_dump 顯示空文件 (Postgres pg_dump show empty file)

將 pg_restore 與多個轉儲一起使用時管理外鍵 (Managing foreign keys when using pg_restore with multiple dumps)

設計:在不斷創建和刪除表時運行 pg_dump (Design: running pg_dump when tables are continuously created and dropped)

轉儲文件中視圖預定義的目的是什麼 (What is the purpose of views' predefinitions in dump file)

如何附加 pg_dump 備份命令 PostgreSQL 的日誌輸出 (How to append log output of pg_dump backup command PostgreSQL)

PostgreSQL:單個表的 pg_dump (PostgreSQL: pg_dump for a single table)







留言討論